import os
import sys
import django

# 将后端目录添加到Python路径
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# 设置Django环境变量
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')

# 初始化Django
django.setup()

from projects.models import Project, Version

# 打印所有项目
print("Projects:")
for project in Project.objects.all():
    print(f"  ID: {project.id}, Name: {project.name}")

# 打印所有版本
print("\nVersions:")
for version in Version.objects.all():
    print(f"  ID: {version.id}, Version: {version.version_number}, Project ID: {version.project_id}")